package clientGUI.generalPanels;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.WindowConstants;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JButton;

import clientGUI.CollegeClientGUI;
import clientGUI.userPanels.UPanel;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MainPanel extends UPanel 
{
	  private Image image = null;

	/**
	 * Create the panel.
	 */
	public MainPanel(String filename) 
	{
		this.image = new ImageIcon(filename).getImage();	
		setLayout(null);
		JLabel lblInformationSystemMangment = new JLabel("INFORMATION SYSTEM MANGMENT");
		lblInformationSystemMangment.setBounds(39, 11, 570, 81);
		lblInformationSystemMangment.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 30));
		lblInformationSystemMangment.setForeground(Color.BLUE);
		add(lblInformationSystemMangment);
		JButton btnUserLogIn = new JButton("USER LOG IN");
		btnUserLogIn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0)
			{
				System.out.println(myframe);
				myframe.setInitPanel();
			}
		});
		btnUserLogIn.setForeground(Color.RED);
		btnUserLogIn.setBounds(358, 215, 125, 45);
		btnUserLogIn.setFont(new Font("Stencil", Font.PLAIN, 13));
		add(btnUserLogIn);
		
		JButton btnClose = new JButton("CLOSE");
		btnClose.setBounds(39, 367, 109, 45);
		btnClose.setForeground(Color.RED);
		btnClose.setFont(new Font("Stencil", Font.PLAIN, 13));
		add(btnClose);

	}
	
	 protected void paintComponent(Graphics g) {
	        super.paintComponent(g);
	        g.drawImage(image, 0, 0, image.getWidth(null), image.getHeight(null), null);
	 }
	 
	 
	 public static void main(String[] args) {
	        MainPanel panel = new MainPanel("ims.jpg");

	        JFrame frame = new JFrame("Frame");
	        frame.setSize(1600, 1200);
	        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	        frame.getContentPane().add(panel, BorderLayout.CENTER);
	        frame.setVisible(true);
	    }
	
	
	
}
